import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '自定义报价主题',
    dataIndex: 'rfqTheme',
    edit: true,
    editable: false,
  },
  {
    title: '计算方式',
    dataIndex: 'calculationMethod',
    edit: true,
    editable: false,
  },
  {
    title: '计算比例',
    dataIndex: 'calculateProportion',
    edit: true,
    editable: false,
  },
  {
    title: '针对字段',
    dataIndex: 'regardingFields',
    edit: true,
    editable: false,
  },
  {
    title: '启用状态',
    dataIndex: 'status',
    slots: { customRender: 'statusSwitch' }, // 使用插槽自定义渲染
    width: 100,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    label: '自定义报价主题',
    field: 'rfqTheme',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'themestatus',
      placeholder: '请选择状态',
      allowClear: true,
    },
  },
];

export const formSchema: FormSchema[] = [
  // TODO 主键隐藏字段，目前写死为ID
  { label: '', field: 'id', component: 'Input', show: false },
  {
    label: '自定义报价主题',
    field: 'rfqTheme',
    component: 'Input',
  },
  {
    label: '计算方式',
    field: 'calculationMethod',
    component: 'Input',
  },
  {
    label: '计算比例',
    field: 'calculateProportion',
    component: 'InputNumber',
  },
  {
    label: '针对字段',
    field: 'regardingFields',
    component: 'Input',
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    defaultValue: '1',
    componentProps: {
      dictCode: 'themestatus',
      placeholder: '请选择状态',
      allowClear: true,
    },
  },
];
